<template>
  <div>
    <hmhead></hmhead>
    <van-nav-bar
      class="reset"
      title="图文资讯"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <!-- 列表 -->
    <div class="newslist">
      <div>
        <div class="item" @click="$router.push(`/newsdetail/${item.id}`)" v-for="item in newsList" :key="item.id">
          <div class="new-img">
            <img :src="item.img_url" alt="" />
          </div>
          <div class="content">
            <p>{{item.zhaiyao}}</p>
            <span>发表时间：</span>
            <span>{{new Date() | dateFormat }}</span>
            <span style="float:right">点击：1</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import hmhead from "@/component/hm-head.vue";
import {newsList} from "@/api/news"
import {dateFormat} from "@/utils/filter"
export default {
    filters: {
        dateFormat
    },
    data(){
        return{
            newsList:[],
        }
    },
  components: {
    hmhead,
  },
  methods: {
    onClickLeft() {
      Toast("返回");
    },
  },
  mounted(){
      newsList().then(res=>{
        //   console.log(res);
          this.newsList = res.data.message
      })
  }
};
</script>

<style lang="less" scoped>
/deep/.van-nav-bar__title {
  color: #26a2ff !important;
}
.newslist{
    padding: 10px 15px 60px 15px;
    .item{
        display: flex;
         height: 60px;
         padding-bottom: 10px;
        .new-img{
        img{
            width: 80px;
            height: 60px;
        }
    }
    .content{
        p{
            font-size: 18px;
            color: #777777;
            margin-bottom: 5px;
        }
        span{
            font-size: 15px;
            color: #75c5ff;
        }
    }
    }
}
</style>
